#ifndef _SOCK_H_
#define _SOCK_H_

#include <string>
#include "../os/os_socket.h"
#include "../include/basedef.h"

class CSockLite
{
	CSockLite (const CSockLite&);
	const CSockLite &operator = (const CSockLite&);

public:
	CSockLite(void);
	virtual ~CSockLite(void);

// Construction
public:
	os_socket_t GetSocket() const;

	virtual bool Create();
	virtual void Attach( os_socket_t hSocket );
	virtual void Close();
	virtual bool Connect(const char* lpszHostAddress, UINT nHostPort);
	virtual int  Send(const void* lpBuf, int nBufLen, int nFlags = 0);
	virtual int  Receive(void* lpBuf, int nBufLen, int nFlags = 0);

public:
	bool IOCtl( long command, DWORD* args );

	bool GetPeerName( std::string& rPeerAddress, UINT& rPeerPort );
	bool GetSockName( std::string& rSocketAddress, UINT& rSocketPort );

	bool HasError();

protected:
	os_socket_t		m_hSocket;
};


#endif